package com.hsp_java.list_;

import java.util.ArrayList;
import java.util.List;

public class ListMethod {
    public static void main(String[] args) {
        List list = new ArrayList();
        list.add("Jack");
        list.add("Jack");
        list.add("Black");
        list.add("马邦德");

        List list2 = new ArrayList();
        list2.add("Tom");
        list2.add("Jerry");

        list.addAll(3, list2);

        list.removeAll(list2);



        System.out.println(list);

        System.out.println(list.indexOf("Black"));
        System.out.println(list.lastIndexOf("Jack"));

        //替换下标对应内容
        list.set(0, "fdsf");
        //移除下标对应内容
        list.remove(0);
        System.out.println(list);
        //左闭右开
        System.out.println(list.subList(0, 3));


    }
}
